/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Principal.java
 *
 * Created on 29/03/2010, 11:40:06 AM
 */

package agencia.form;

import agencia.controller.AgenciaController;
import agencia.controller.ClienteController;
import agencia.controller.GuiaController;
import agencia.controller.LugarTuristicoController;
import agencia.controller.PaqueteController;
import agencia.controller.TipoLugarcontroller;

/**
 *
 * @author elvis
 */
public class Principal extends javax.swing.JFrame {

    private AgenciaController agenciaController;
    private LugarTuristicoController lugarTuristicoController;
    private PaqueteController paqueteController;
    private GuiaController guiaController;
    private TipoLugarcontroller tipoLugarcontroller;
    private ClienteController clienteController;
    private AgenciaListaform agencia;
    private SitioListaForm sitio;
    private PaqueteListaForm paqueteListaForm;
    private GuiaListaForm guiaListaForm;
    private ReservaTour reservaTour ;

    /** Creates new form Principal */
    public Principal() {
        initComponents();
        agenciaController = new AgenciaController();
        lugarTuristicoController = new LugarTuristicoController();
        paqueteController = new PaqueteController();
        guiaController = new GuiaController();
        tipoLugarcontroller = new TipoLugarcontroller();
        clienteController = new ClienteController();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jMenu6.setText("Venta");

        jMenuItem6.setText("Reserva de Guia");
        jMenu6.add(jMenuItem6);

        jMenuItem4.setText("Venta de tour");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem4);

        jMenuBar1.add(jMenu6);

        jMenu5.setText("Agencias");

        jMenuItem5.setText("Lista de Agencias");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem5);

        jMenuBar1.add(jMenu5);

        jMenu1.setText("Guias");

        jMenuItem1.setText("Nuevo guia");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Sitios");

        jMenuItem2.setText("Nuevo Sitio");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Paquetes");
        jMenu3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu3ActionPerformed(evt);
            }
        });

        jMenuItem3.setText("Nuevo Paquete");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem3);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Estadisticas");
        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
        agencia = new AgenciaListaform();
        agencia.setAgenciaController(this.agenciaController);
        agencia.setJdesktopPane(jDesktopPane1);
        agencia.iniciarForm();
        this.jDesktopPane1.add(agencia);
        agencia.show();
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        sitio = new SitioListaForm();
        sitio.setSitioController(lugarTuristicoController);
        sitio.setTipoLugarcontroller(tipoLugarcontroller);
        sitio.setJdesktopPane(jDesktopPane1);
        sitio.iniciarForm();
        jDesktopPane1.add(sitio);
        sitio.show();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
        // TODO no usar este metodo, es del menu idebe estar  programado en el item
      
    }//GEN-LAST:event_jMenu3ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:
        paqueteListaForm = new PaqueteListaForm();
        paqueteListaForm.setPaqueteController(paqueteController);
        paqueteListaForm.setAgenciaController(agenciaController);
        paqueteListaForm.setLugarTuristicoController(lugarTuristicoController);
        paqueteListaForm.iniciarForm();
        paqueteListaForm.setJdesktopPane(jDesktopPane1);
        jDesktopPane1.add(paqueteListaForm);
        paqueteListaForm.show();
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        guiaListaForm = new GuiaListaForm();
        guiaListaForm.setJdesktopPane(this.jDesktopPane1);
        guiaListaForm.setGuiaController(guiaController);
        guiaListaForm.setAgenciaController(agenciaController);
        guiaListaForm.iniciaform();
        jDesktopPane1.add(guiaListaForm);
        guiaListaForm.show();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // TODO add your handling code here:
        reservaTour = new ReservaTour();
        reservaTour.setPaqueteController(paqueteController);
        reservaTour.setjDesktopPane(jDesktopPane1);
        reservaTour.setClienteController(clienteController);
        reservaTour.iniciaform(agenciaController.obtenerAgencia(1));
        jDesktopPane1.add(reservaTour);
        reservaTour.show();
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    // End of variables declaration//GEN-END:variables

}
